package svc

import (
	"dnsresolver/internal/config"

	dnsresolver "dnsresolver/rpc/client/dnsresolver"

	"github.com/zeromicro/go-zero/core/logx"
	"github.com/zeromicro/go-zero/zrpc"
)

type ServiceContext struct {
	Config config.Config
	Rpc    dnsresolver.Dnsresolver
}

func NewServiceContext(c config.Config) *ServiceContext {
	logx.Infof("target: %s", c.DnsResolver.Target)
	return &ServiceContext{
		Config: c,
		Rpc:    dnsresolver.NewDnsresolver(zrpc.MustNewClient(c.DnsResolver)),
	}
}
